]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panelMenu: Clean up code a bit
authorFlorian Müllner <fmuellner@gnome.org>
Sun, 8 Jun 2014 19:18:49 +0000 (21:18 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 8 Jun 2014 20:25:27 +0000 (22:25 +0200)
js/ui/panelMenu.js

index 9bb1f1bc493495fa085a081d97d737bff6c26b59..07494d181532986a7651b4ec909a0065f333f9fd 100644 (file)
@@ -41,8 +41,7 @@ const ButtonBox = new Lang.Class({
     },
 
     _getPreferredWidth: function(actor, forHeight, alloc) {
-        let children = actor.get_children();
-        let child = children.length > 0 ? children[0] : null;
+        let child = actor.get_first_child();
 
         if (child) {
             [alloc.min_size, alloc.natural_size] = child.get_preferred_width(-1);
@@ -55,8 +54,7 @@ const ButtonBox = new Lang.Class({
     },
 
     _getPreferredHeight: function(actor, forWidth, alloc) {
-        let children = actor.get_children();
-        let child = children.length > 0 ? children[0] : null;
+        let child = actor.get_first_child();
 
         if (child) {
             [alloc.min_size, alloc.natural_size] = child.get_preferred_height(-1);
@@ -66,13 +64,11 @@ const ButtonBox = new Lang.Class({
     },
 
     _allocate: function(actor, box, flags) {
-        let children = actor.get_children();
-        if (children.length == 0)
+        let child = actor.get_first_child();
+        if (!child)
             return;
 
-        let child = children[0];
         let [minWidth, natWidth] = child.get_preferred_width(-1);
-        let [minHeight, natHeight] = child.get_preferred_height(-1);
 
         let availWidth = box.x2 - box.x1;
         let availHeight = box.y2 - box.y1;